package com.panshi.api;

import com.panshi.vo.R;
import com.panshi.vo.UserVO;
import com.panshi.vo.ItemQueryUserVo;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.models.auth.In;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

@Component
@FeignClient(value = "hasbei-user.com",path = "/user",contextId = "userLogin")
public interface UserApi {

    //用户登录
    @RequestMapping(value = "/login",method = RequestMethod.POST)
    R userLogin(@RequestBody String principal);

    //用户注册
    @RequestMapping(value = "/register",method = RequestMethod.POST)
    R userRegister(@RequestBody UserVO userVO);

    //验证码
    @RequestMapping(value = "/verifyCode",method = RequestMethod.POST)
    R verifyCode (@RequestBody String principal);

    @RequestMapping(value="/verifyCodeRegitser",method=RequestMethod.POST)
    @ApiOperation("发送注册验证码接口")
    public R verifyCodeRegitser(@RequestBody String username);

    //验证码登录
    @RequestMapping(value = "/verifyLogin",method = RequestMethod.POST)
    R verifyLogin(@RequestBody String principal);

    @RequestMapping(value = "/getUserId",method = RequestMethod.POST)
    @ApiOperation("获取用户ID")
    public R getUserId(@RequestBody String userName);

    @RequestMapping(value = "/center/getUserInfo",method = RequestMethod.GET)
    @ApiOperation("查询前台用户个人信息")
    public R getUserInfo(@RequestParam("id") Long id);

    @RequestMapping(value = "/center/updateUserInfo",method = RequestMethod.PUT)
    @ApiOperation("修改前台用户个人信息")
    public R updateUserInfo(@RequestBody ItemQueryUserVo itemQueryVo);

    @RequestMapping(value = "/center/update/updatePwd",method = RequestMethod.PUT)
    @ApiOperation("修改个人密码")
    public R updatePwd(@RequestBody ItemQueryUserVo itemQueryVo) ;

    @RequestMapping(value ="/center/index",method = RequestMethod.POST)
    @ApiOperation("查询个人动态信息")
    public R userIndex(@RequestBody ItemQueryUserVo itemQueryVoParam);

    @RequestMapping(value ="/index/dy/list",method = RequestMethod.POST)
    @ApiOperation("查询个人动态信息")
    public R dyList(@RequestBody ItemQueryUserVo itemQueryVoParam);

    @RequestMapping(value = "/center/public/del",method = RequestMethod.DELETE)
    @ApiOperation("删除个人动态")
    public R delDy(@RequestParam("id")int id);

    @RequestMapping(value = "/collect/del",method = RequestMethod.DELETE)
    @ApiOperation("删除个人收藏")
    public R delCollect(@RequestParam("id")Long id);

    @RequestMapping(value = "/index/msg/read",method = RequestMethod.GET)
    @ApiOperation("个人站内消息阅读")
    public R readNotice(@RequestParam("ids")int id);

    @RequestMapping(value = "/index/getNoReadCount",method = RequestMethod.GET)
    @ApiOperation("个人站内消息未读数")
    public R getNoReadCount(@RequestParam("id")int id);

    @RequestMapping(value = "/index/qalist",method = RequestMethod.POST)
    @ApiOperation("查询个人提问列表")
    public R qaList(@RequestBody ItemQueryUserVo itemQueryVo);

    @RequestMapping(value = "/index/qaReplylist",method = RequestMethod.POST)
    @ApiOperation("查询个人回答列表")
    public R answerList(@RequestBody ItemQueryUserVo itemQueryVo);

    @RequestMapping(value = "/index/articlelist",method = RequestMethod.POST)
    @ApiOperation("查询个人资讯列表")
    public R zxList(@RequestBody ItemQueryUserVo itemQueryVo);

    @RequestMapping(value = "/index/collectList",method = RequestMethod.POST)
    @ApiOperation("查询个人收藏列表")
    public R collectList(@RequestBody ItemQueryUserVo itemQueryVo);

    @RequestMapping(value = "/index/msg/list",method = RequestMethod.POST)
    @ApiOperation("查询个人站内消息列表")
    public R msgList(@RequestBody ItemQueryUserVo itemQueryVo);

    @RequestMapping(value = "/center/update/updateUserHeadBaseCode",method = RequestMethod.PUT)
    @ApiOperation("修改个人头像图片")
    public R updateUserHeadBaseCode(@RequestBody ItemQueryUserVo itemQueryVo);

    @RequestMapping(value = "/center/update/sendEmail/{userId}/{userName}/{type}",method = RequestMethod.GET)
    @ApiOperation("发送修改邮箱验证码")
    public R sendEmail(@PathVariable("userId")Integer userId,@PathVariable("userName")String userName,@PathVariable("type")String type);

    @RequestMapping(value = "/center/update/confirm/email/{userId}/{userName}/{code}/{type}",method =RequestMethod.POST)
    @ApiOperation("检验邮箱验证码是否正确")
    public R checkEmailCode(@PathVariable("userId")Integer userId,@PathVariable("userName")String userName,@PathVariable("code")String code,@PathVariable("type")String type);

    @RequestMapping(value = "/center/update/sendIphone/{userId}/{userName}/{type}",method = RequestMethod.GET)
    @ApiOperation("发送手机短信验证码")
    public R sendIphone(@PathVariable("userId")Integer userId,@PathVariable("userName")String userName,@PathVariable("type")String type);

    @RequestMapping(value = "/center/update/confirm/iphone/{userId}/{userName}/{code}/{type}",method =RequestMethod.POST)
    @ApiOperation("检验短信验证码是否正确")
    public R checkIphoneCode(@PathVariable("userId")Integer userId,@PathVariable("userName")String userName,@PathVariable("code")String code,@PathVariable("type")String type);
}
